package com.bestapp.mydialogfragemntdemo;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import com.sevenday.lwdialog.CommonDialog;
import com.sevenday.lwdialog.ConfirmDialog;
import com.sevenday.lwdialog.base.BaseDialog;
import com.sevenday.lwdialog.interfaces.ViewConvertListener;
import com.sevenday.lwdialog.interfaces.ViewHolder;

public class MainActivity extends AppCompatActivity {

    Button btn1,btn2;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        btn1=findViewById(R.id.btn1);
        btn1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                show1();
            }
        });
        btn2=findViewById(R.id.btn2);
        btn2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                show2();
            }
        });
    }

    private void show2() {
        CommonDialog.newInstance()
                .setLayoutId(R.layout.dialog_friend)
                .setConvertListener(new ViewConvertListener() {
                    @Override
                    public void convertView(ViewHolder holder, final BaseDialog dialog) {

                    }
                })
                .setShowBottom(true)
//                .setSize(0, 310)
                .show(getSupportFragmentManager());

    }

    private void show1() {
        ConfirmDialog.newInstance("1")
                .setMargin(10)
                .setOutCancel(false)
                .show(getSupportFragmentManager());
    }
}
